﻿/* ----------------------------------------------------------------------------
 * Copyright (c) Philip Stears 
 *
 * This source code is subject to terms and conditions of the Microsoft Public 
 * License (Ms-PL).
 * 
 * By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 * 
 * To request a copy of the Microsoft Public License, send a request by email
 * to license@connectbasic.net.
 *
 * This notice must not be removed from this software.
 * ---------------------------------------------------------------------------- */

namespace ConnectBasic.Shell.Hosting
{
    using System;

    /// <summary>
    /// The exception thrown when a shell can't be created successfully.
    /// </summary>
    [Serializable]
    public class ShellCreationException : Exception
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="ShellCreationException" /> class.
        /// </summary>
        public ShellCreationException()
            : base(DefaultMessage)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ShellCreationException" /> class.
        /// </summary>
        public ShellCreationException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ShellCreationException" /> class.
        /// </summary>
        public ShellCreationException(string message, Exception inner)
            : base(message, inner)
        {
        }

        /// <summary>
        /// Implements the deserialization constructor for the <see cref="ShellCreationException" /> class.
        /// </summary>
        protected ShellCreationException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
        }

        /// <summary>
        /// Gets the default error message for the exception.
        /// </summary>
        public static string DefaultMessage
        {
            get { return Properties.Resources.ExShellCreate; }
        }
    }

    /// <summary>
    /// The exception thrown when one or more host settings
    /// are invalid.
    /// </summary>
    [Serializable]
    public class HostSettingsException : Exception
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="HostSettingsException" /> class.
        /// </summary>
        public HostSettingsException()
            : base(DefaultMessage)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="HostSettingsException" /> class.
        /// </summary>
        public HostSettingsException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="HostSettingsException" /> class.
        /// </summary>
        public HostSettingsException(string message, Exception inner)
            : base(message, inner)
        {
        }

        /// <summary>
        /// Implements the deserialization constructor for the <see cref="HostSettingsException" /> class.
        /// </summary>
        protected HostSettingsException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
        }

        /// <summary>
        /// Gets the default error message for the exception.
        /// </summary>
        public static string DefaultMessage
        {
            get { return Properties.Resources.ExHostSettingsDefault; }
        }
    }
}
